
//
//  ConstantUtils.h
//  blocklyios
//
//  Created by steward on 2019/3/21.
//  Copyright © 2019 szltech. All rights reserved.
//

#import <Foundation/Foundation.h>
#define WRITE_TO_DEVICE @"writeToDevice"
#define WRITE_DEBUG_STR_TO_DEVICE @"writeDebugStrToDevice"
#define SAVE_STR @"saveStr"
#define DELETE_STR @"deleteStr"
#define GET_STR @"getStr"

NS_ASSUME_NONNULL_BEGIN

@interface ConstantUtils : NSObject
/**
 * 将字符串转化为16进制并在后面加上回车换行
 *
 * @param s 原始字符串
 * @return 加换行后的字符串
 */
+ (NSString *)addPostfixTo16: (NSString *)s;
//普通字符串转换为十六进制
+ (NSString *)hexStringFromString:(NSString *)string;

/**
 * 包装调试模式命令
 * @param originStr 原始命令
 * @return 包装后硬件可以识别的命令
 */
+ (NSString *)getDebugSendStr: (NSString *)originStr;

/**
 * 包装命令
 * @param originStr 原始命令
 * @return 包装后硬件可以识别的命令
 */
+ (NSString *)getSendStr: (NSString *)originStr;

+ (NSData *)str2Data: (NSString *)str;
+ (NSString *)data2Str: (NSData *)data;
+ (NSString *)getStr:(NSString *)key;
+ (void)deleteStr:(NSString *)key;
+ (void)saveStr:(NSString *)key value:(NSString *)value;
+ (NSString *)stringFromHexString:(NSString *)hexString;
+ (NSData *)convertHexStrToData:(NSString *)str;
+ (NSString *)convertDataToHexStr:(NSData *)data;

@end

NS_ASSUME_NONNULL_END
